<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
        name="viewport">
  <meta content="ie=edge" http-equiv="X-UA-Compatible">
  <title>Document</title>
</head>
<body>
<script>
  let arr = [1, 2, [3, 4, [10, 20, [100, 200]]], 5]
  while (arr.some(item => Array.isArray(item))) {
    arr = [].concat(...arr)
  }
  console.log(arr);
</script>
</body>
</html>
